﻿<presentation:UserControlView x:Class="Chronos.Client.Win.Views.Sessions.ActiveSessions.View"
                              xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                              xmlns:presentation="clr-namespace:Rhiannon.Windows.Presentation;assembly=Rhiannon.Windows"
							  xmlns:controls="clr-namespace:Rhiannon.Windows.Controls;assembly=Rhiannon.Windows"
                              xmlns:converters="clr-namespace:Rhiannon.Windows.Presentation.Converters;assembly=Rhiannon.Windows"
                              xmlns:commands="clr-namespace:Rhiannon.Windows.Presentation.Commands;assembly=Rhiannon.Windows"
                              x:Uid="Profiler_Sessions_ActiveSessionsView">
	<presentation:UserControlView.Resources>
		<converters:ByteArrayToBitmapSourceConverter x:Key="ByteArrayToBitmapSourceConverter" />
		<Style x:Key="SessionButtonStyle" TargetType="{x:Type Button}">
			<Setter Property="SnapsToDevicePixels" Value="True" />
			<Setter Property="Cursor" Value="Hand" />
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type Button}">
						<Border Margin="{TemplateBinding Padding}">
							<Border Name="Border" Background="#FFFFFF">
								<ContentPresenter />
							</Border>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter TargetName="Border" Property="Background" Value="#F6F6F6" />
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
	</presentation:UserControlView.Resources>
	<Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="*" />
		</Grid.RowDefinitions>
		<!--<Border Background="#E6E6E6">
			<Grid Height="27" Grid.Row="0">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="*" />
					<ColumnDefinition Width="200" />
					<ColumnDefinition Width="150" />
				</Grid.ColumnDefinitions>
				<Border Grid.Column="0" BorderBrush="#F6F6F6" BorderThickness="0,0,2,0">
					<TextBlock Text="Process" HorizontalAlignment="Center" FontSize="16"/>
				</Border>
				<Border Grid.Column="1" BorderBrush="#F6F6F6" BorderThickness="0,0,2,0">
					<TextBlock Text="Configuration" HorizontalAlignment="Center" FontSize="16"/>
				</Border>
				<Border Grid.Column="2">
					<TextBlock Text="Start Time" HorizontalAlignment="Center" FontSize="16"/>
				</Border>
			</Grid>
		</Border>-->
		<ItemsControl Grid.Row="1" ItemsSource="{Binding Sessions}">
			<ItemsControl.ItemTemplate>
				<DataTemplate>
					<Button Style="{StaticResource SessionButtonStyle}"
							commands:Event.Command="{Binding Path=DataContext.OpenSessionCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type presentation:UserControlView}}}"
							commands:Event.CommandParameter="{Binding}">
						<Grid>
							<!--<Grid.ColumnDefinitions>
								<ColumnDefinition Width="*" />
								<ColumnDefinition Width="200" />
								<ColumnDefinition Width="150" />
							</Grid.ColumnDefinitions>-->
							<Border Grid.Column="0">
								<StackPanel Orientation="Horizontal">
									<controls:BlurlessImage Source="{Binding ProcessInfo.ProcessIcon, Converter={StaticResource ByteArrayToBitmapSourceConverter}}" />
									<TextBlock Text="{Binding ProcessInfo.ExecutableFullName}"/>
								</StackPanel>
							</Border>
							<!--<Border Grid.Column="1" BorderBrush="#FFFFFF" BorderThickness="0,0,2,0">
								<TextBlock Text="{Binding Configuration.Name}"/>
							</Border>
							<Border Grid.Column="2" BorderBrush="#FFFFFF" BorderThickness="0,0,2,0">
								<TextBlock Text="{Binding ProcessInfo.StartTime}"/>
							</Border>-->
						</Grid>
					</Button>
				</DataTemplate>
			</ItemsControl.ItemTemplate>
		</ItemsControl>
	</Grid>
</presentation:UserControlView>